<template>
	<div>
		<el-tabs v-model="activeName">
			<el-tab-pane v-for="(item, index) in tabsList" :key="index" :label="item.label" :name="item.value"> </el-tab-pane>

			<div class="content-card">
				<html-label title="基本信息" v-if="activeName == 'BaseDetail'"> </html-label>

				<component
					v-if="!loading"
					class="pd10"
					:is="whickComm[activeName]"
					:soleKey="`dpServiceProvider-${nowData.creditCode}`"
					@refresh="handleRefresh"
					:nowRowData="nowData"
				></component>
			</div>
		</el-tabs>
	</div>
</template>

<script setup lang="ts">
import BaseDetail from '@/views/datacenter/basicData/volunteer/Archives/BaseDetail/index.vue'
import { getAreaObj } from '@/utils/util'

type Props = {
	nowRowData?: any
}
const props = withDefaults(defineProps<Props>(), {})

const emit = defineEmits(['refresh', 'rechange'])
const loading = ref(false)

const whickComm = {
	BaseDetail,
}

const tabsList: any = [{ label: '基础信息', value: 'BaseDetail' }]
const activeName = ref('BaseDetail')

let nowData = ref(props.nowRowData)
provide('nowRowData', nowData)

const getInitData = () => {
	const cr_areas = getAreaObj(props.nowRowData, 'cr')
	const areas_name = getAreaObj(props.nowRowData, '')
	const registerArea: any = getAreaObj(props.nowRowData, 'register_org', 'set')
	nowData.value = {
		...props.nowRowData,
		cr_areas,
		areas_name,
		registerAreaNames: registerArea.names,
	}
}

const handleRefresh = () => {
	emit('refresh')
}

onMounted(() => {
	getInitData()
})
</script>

<style scoped></style>
